﻿package
{
	import flash.display.MovieClip; 
	import Util.*;
	
	public class Test extends MovieClip
	{
		public static function dump(obj:*, ...param)
		{
			var length:int = 0;
			
			if (param.length == 1) {
				length = param[0];
			}
			
			var tab:String = '';
			for (var i:int = 0; i < length; i++) {
				tab += '	';
			}
			
			length++;
			for (var index in obj)
			{
				if (obj[index] is String || obj[index] is Number || obj[index] is Boolean)
				{
					trace(tab + index + ' : ' + obj[index].toString());
				}
				else
				{
					trace(tab + index + ':');
					dump(obj[index], length);
				}
			}
		}
		
		public function Test()
		{
			var d:Date = new Date();
			
			var start:Number = d.getTime();
			
			var remoting:IRemoting = RemotingFactory.create('http://kelezyb/test.php', 'Hello', RemotingFactory.REMOTING_TYPE_BINARY);
			try
			{
				remoting.RemotCall("test2", [], function(data) {
					var e:Date = new Date();
					trace(e.getTime() - start);
					dump(data);
				});
			}
			catch (err:RemotingError)
			{
				trace(err.toString());
			}
		}
	}
}